package ru.averta.notes.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import ru.averta.notes.dao.CoolMarkDao;
import ru.averta.notes.domain.CoolMark;
import ru.averta.notes.domain.Site;
import ru.averta.notes.other.UtilsCommon;
import ru.averta.notes.service.CoolMarkService;

/**
 * <code>CoolMarkServiceImpl</code>
 *
 * @author fedor.belov (fedor.belov@mail.ru)
 *         Date: 13.09.11 15:40
 */

@Service
@Transactional
public class CoolMarkServiceImpl implements CoolMarkService {

    @Autowired private CoolMarkDao dao;

    @Override public void save(CoolMark mark) {
        dao.save(mark);
    }

    @Override public void removeAllMarksForSite(Site site) {
        for (CoolMark mark : UtilsCommon.collectionToRemove(site.getMarks())) dao.remove(mark);
    }
}
